import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PluginsSecretKeyVO, PluginsSecretKeyForm, PluginsSecretKeyQuery } from '@/api/goods/pluginsSecretKey/types';

/**
 * 查询插件密钥列表
 * @param query
 * @returns {*}
 */

export const listPluginsSecretKey = (query?: PluginsSecretKeyQuery): AxiosPromise<PluginsSecretKeyVO[]> => {
  return request({
    url: '/order/pluginsSecretKey/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询插件密钥详细
 * @param id
 */
export const getPluginsSecretKey = (id: string | number): AxiosPromise<PluginsSecretKeyVO> => {
  return request({
    url: '/order/pluginsSecretKey/' + id,
    method: 'get'
  });
};

/**
 * 新增插件密钥
 * @param data
 */
export const addPluginsSecretKey = (data: PluginsSecretKeyForm) => {
  return request({
    url: '/order/pluginsSecretKey',
    method: 'post',
    data: data
  });
};

/**
 * 修改插件密钥
 * @param data
 */
export const updatePluginsSecretKey = (data: PluginsSecretKeyForm) => {
  return request({
    url: '/order/pluginsSecretKey',
    method: 'put',
    data: data
  });
};

/**
 * 删除插件密钥
 * @param id
 */
export const delPluginsSecretKey = (id: string | number | Array<string | number>) => {
  return request({
    url: '/order/pluginsSecretKey/' + id,
    method: 'delete'
  });
};
